import { _decorator, Component, Node, Sprite, SpriteFrame, UITransform } from 'cc';
const { ccclass, property } = _decorator;
/* @author: seagull  @change:单个瓦片信息管理
 * @date: 2024/11/23 15:05 */
const TILE_WIDTH = 55
const TILE_HEIGHT = 55

@ccclass('TileManager')
export class TileManager extends Component {
    init(tileSpriteFrame: SpriteFrame, i: number, j: number) {
        const tileSprite = this.addComponent(Sprite);
        tileSprite.spriteFrame = tileSpriteFrame;


        const transform = this.getComponent(UITransform);
        transform.setContentSize(TILE_WIDTH, TILE_HEIGHT);

        this.node.setPosition(i * TILE_WIDTH, -j * TILE_HEIGHT)//左上角加载
    }
}


